#!/usr/bin/env bash
while true
do

# 更新数据库进程
python_pid=`ps aux |grep start_update_process.py |grep python | awk '{print $2;}'`
if [ "$python_pid" == '' ]; then
    nohup python start_update_process.py 'config/cmb_gsxt_search.conf' > log/hubei.file 2>&1 &
fi
echo ${python_pid}

# 湖北
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep hubei | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'hubei' > log/hubei.file 2>&1 &
#fi
#echo ${python_pid}

# 安徽
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep anhui | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'anhui' > log/anhui.file 2>&1 &
#fi
#echo ${python_pid}

# 西藏
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep xizang | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'xizang' > log/xizang.file 2>&1 &
#fi
#echo ${python_pid}

# 青海
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep qinghai | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'qinghai' > log/qinghai.file 2>&1 &
#fi
#echo ${python_pid}

# 黑龙江
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep -w heilongjiang | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'heilongjiang' > log/heilongjiang.file 2>&1 &
#fi
#echo ${python_pid}

# 河南
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep henan | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'henan' > log/henan.file 2>&1 &
#fi
#echo ${python_pid}

# 北京
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep beijing | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'beijing' > log/beijing.file 2>&1 &
#fi
#echo ${python_pid}

# 山西
python_pid=`ps aux |grep start_task_crawler.py |grep python | grep -w cmb_gsxt_search.conf  | grep -w shanxicu | awk '{print $2;}'`
if [ "$python_pid" == '' ]; then
    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'shanxicu' > log/shanxicu.file 2>&1 &
fi
echo ${python_pid}

# 海南
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep hainan | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'hainan' > log/hainan.file 2>&1 &
#fi
#echo ${python_pid}

# 山东
python_pid=`ps aux |grep start_task_crawler.py |grep python | grep -w cmb_gsxt_search.conf  | grep -w shandong | awk '{print $2;}'`
if [ "$python_pid" == '' ]; then
    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'shandong' > log/shandong.file 2>&1 &
fi
echo ${python_pid}

# 江苏
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep jiangsu | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'jiangsu' > log/jiangsu.file 2>&1 &
#fi
#echo ${python_pid}


# 广东
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep guangdong | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'guangdong' > log/guangdong.file 2>&1 &
#fi
#echo ${python_pid}

# 重庆
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep chongqing | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'chongqing' > log/chongqing.file 2>&1 &
#fi
#echo ${python_pid}


# 天津
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep tianjin | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'tianjin' > log/tianjin.file 2>&1 &
#fi
#echo ${python_pid}

# 新疆
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep xinjiang | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'xinjiang' > log/xinjiang.file 2>&1 &
#fi
#echo ${python_pid}

# 陕西
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep -w shanxi | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'shanxi' > log/shanxi.file 2>&1 &
#fi
#echo ${python_pid}

# 湖南
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep hunan | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'hunan' > log/hunan.file 2>&1 &
#fi
#echo ${python_pid}

# 宁夏
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep ningxia | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'ningxia' > log/ningxia.file 2>&1 &
#fi
#echo ${python_pid}

# 辽宁
python_pid=`ps aux |grep start_task_crawler.py |grep python | grep -w cmb_gsxt_search.conf  | grep -w liaoning | awk '{print $2;}'`
if [ "$python_pid" == '' ]; then
    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'liaoning' > log/liaoning.file 2>&1 &
fi
echo ${python_pid}

# 四川
#python_pid=`ps aux |grep start_task_crawler.py |grep python | grep sichuan | awk '{print $2;}'`
#if [ "$python_pid" == '' ]; then
#    nohup python start_task_crawler.py 'config/cmb_gsxt_search.conf' 'sichuan' > log/sichuan.file 2>&1 &
#fi
#echo ${python_pid}


inter_time=10
sleep ${inter_time}
done